package com.leyou.item.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.leyou.item.dto.BrandDTO;
import com.leyou.item.entity.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface BrandMapper extends BaseMapper<Brand> {

//    @Select("select tb.id,tb.name,tb.image,tb.letter from tb_catagory_brand tcb inner join tb_brand tb on tb.id=tcb.brand_id where tcb.category_id=#{cid}")
//    List<Brand> queryBrandByCategory(@Param("cid") Long cid);
@Select("SELECT b.id, b.name, b.letter, b.image FROM tb_category_brand cb INNER JOIN tb_brand b ON b.id = cb.brand_id WHERE cb.category_id = #{cid}")
List<Brand> queryBrandByCategory(@Param("cid") Long cid);
}